package com.ruoyi.web.controller.customer;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysAimodel;
import com.ruoyi.system.service.ISysAimodelService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 模特基础信息Controller
 * 
 * @author ruoyi
 * @date 2024-11-20
 */
@RestController
@RequestMapping("/system/aimodel")
public class SysAimodelController extends BaseController
{
    @Autowired
    private ISysAimodelService sysAimodelService;

    /**
     * 查询模特基础信息列表
     */
    @GetMapping("/list")
    public TableDataInfo list(SysAimodel sysAimodel)
    {
        startPage();
        List<SysAimodel> list = sysAimodelService.selectSysAimodelList(sysAimodel);
        return getDataTable(list);
    }

    /**
     * 导出模特基础信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:aimodel:export')")
    @Log(title = "模特基础信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysAimodel sysAimodel)
    {
        List<SysAimodel> list = sysAimodelService.selectSysAimodelList(sysAimodel);
        ExcelUtil<SysAimodel> util = new ExcelUtil<SysAimodel>(SysAimodel.class);
        util.exportExcel(response, list, "模特基础信息数据");
    }

    /**
     * 获取模特基础信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:aimodel:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysAimodelService.selectSysAimodelById(id));
    }

    /**
     * 新增模特基础信息
     */
    @PreAuthorize("@ss.hasPermi('system:aimodel:add')")
    @Log(title = "模特基础信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysAimodel sysAimodel)
    {
        return toAjax(sysAimodelService.insertSysAimodel(sysAimodel));
    }

    /**
     * 修改模特基础信息
     */
    @PreAuthorize("@ss.hasPermi('system:aimodel:edit')")
    @Log(title = "模特基础信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysAimodel sysAimodel)
    {
        return toAjax(sysAimodelService.updateSysAimodel(sysAimodel));
    }

    /**
     * 删除模特基础信息
     */
    @PreAuthorize("@ss.hasPermi('system:aimodel:remove')")
    @Log(title = "模特基础信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysAimodelService.deleteSysAimodelByIds(ids));
    }
}
